package com.lclz.model;

import java.util.List;

import javax.ws.rs.core.MediaType;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;

import com.lclz.util.JaxbUtil;
import com.lclz.util.JerseyClientUtil;


public class Test {

	public static void main(String[] args) throws Exception {
		Customer c = new Customer();
		c.setId("code1");
		c.setCustomerName("张三");
		
		Address a = new Address();
		a.setZipCode("305699334");
		a.setCity("shanghai");
		a.setStreet("jingzhongluo");
		
		c.setAddress(a);
		
		//System.out.print(JaxbUtil.obj2xmlStr(c));
		
		String text =JerseyClientUtil.getXml("http://www.oschina.net", "/action/api/news_list", "");
		
		System.out.println(text);
		
//		Client client = Client.create();  
//	    WebResource r = client.resource("http://www.oschina.net/action/api/news_list");  
//	    String response = r.header("Accept", "text/html,application/xhtml+xml,application/xml;")
//	    		.header("Accept-Language", "zh-cn")
//	    		.header("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3")
//	    		.header("Accept-Charset", "encoding")
//	    		.header("Keep-Alive", "300")
//	    		.header("Connection", "Keep-Alive")
//	    		.header("Cache-Control", "no-cache")
//	    		.get(String.class);
//	    System.out.println(response);
//	    //com.lclz.test.JaxbUtil.parseXmlStrToList(News.class,response);
//	   OSChina list = JaxbUtil.xmlStr2Obj(OSChina.class, response);
//	   System.out.println(list);
	    
	}

}
